package cn.susu.test.service;

import cn.susu.test.dao.BookDao;
import cn.susu.test.entity.Book;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.page.PageMethod;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

@Service
public class BookService {

    @Autowired
    private BookDao bookDao;
    public PageInfo<Book> getList(Integer pgeNum) {

        PageHelper.startPage(pgeNum,3);
        List<Book> books = bookDao.queryAllBy(new Book());
        return new PageInfo<>(books);
    }

    public void del(Integer[] ids) {
        bookDao.del(ids);
    }
}
